<?php

function base_url()
{
	global $config;
	return $config['domain'];
}

function site_url($segment = '')
{
	return base_url().($segment != '' ? $segment : '');
}

function module_path()
{
	global $config;
	return $config['document_root'].$config['module_dir'];
}

function client_path()
{
	global $config;
	return module_path().$config['client_dir'];
}

function admin_path()
{
	global $config;
	return module_path().$config['admin_dir'];
}



function public_dir()
{
	global $config;
	return $config['public_dir'];
}

function redirect($url = '')
{
	echo "<script>location.href='$url';</script>";
}

function img_link($file_name = '', $dir = 'images', $module = 'client')
{
	return site_url(public_dir().$module.'/'.$dir.'/'.$file_name);
}

function css_link($file_name = '', $dir = 'css', $module = 'client')
{
	return site_url(public_dir().$module.'/'.$dir.'/'.$file_name);
}

function js_link($file_name = '', $dir = 'js', $module = 'client')
{
	return site_url(public_dir().$module.'/'.$dir.'/'.$file_name);
}